// usePopup.ts
import { ref } from 'vue'
import { IProductResult } from '@/service/index'

const popupState = ref({
  show: false,
  data: {} as IProductResult,
  safe: false,
})

export function usePopup() {
  function showPopup(data: IProductResult) {
    popupState.value.data = data
    popupState.value.show = true
  }

  function hidePopup() {
    popupState.value.show = false
  }

  return {
    popupState,
    showPopup,
    hidePopup,
  }
}
